<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>添加季节</title>
</head>
<body>

<form class="layui-form" lay-filter="layui-form">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
                <div class="layui-form-item" style="width: 40%">
                    <label class="layui-form-label"><text title="必填项" style="color:red;">*</text>名称</label>
                    <div class="layui-input-block">
                        <input type="text"   name="name" lay-verify="required" autocomplete="off" placeholder="请输入图鉴名称" class="layui-input author_input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">关联先祖</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="target"
                             data-sourceType="route"
                             data-source="/admin.sky.ancestor/index"
                             data-textField="name"
                             data-valueField="id"
                             data-paging="true"
                             data-radio="true"
                             data-direction="down"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item" >
                    <label class="layui-form-label">获取途径说明</label>
                    <div class="layui-input-block">
                        <input type="text"   name="remark"  autocomplete="off" placeholder="请输获取途径说明" class="layui-input author_input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">归属</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="category1"
                             data-sourceType="data"
                             data-radio="true"
                             data-source="[{name:'常驻物品',value:'常驻物品'},{name:'季节限定',value:'季节限定'}]"
                             data-layVerify="required"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">类型</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="category"
                             data-sourceType="data"
                             data-radio="true"
                             data-source="[{name:'头饰',value:'头饰'},{name:'动作',value:'动作'},{name:'斗篷',value:'斗篷'},{name:'服饰',value:'服饰'},{name:'面具',value:'面具'},{name:'配饰/道具',value:'配饰/道具'}]"
                             data-layVerify="required"
                        ></div>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">分类</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="sub_category"
                             data-sourceType="data"
                             data-radio="true"
                             data-source="[{name:'季节图鉴',value:'季节图鉴'},{name:'常驻发型',value:'常驻发型'},{name:'常驻动作',value:'常驻动作'},{name:'常驻斗篷',value:'常驻斗篷'},{name:'常驻裤子',value:'常驻裤子'},{name:'常驻配饰',value:'常驻配饰'},{name:'常驻面具',value:'常驻面具'}]"
                             data-layVerify="required"
                        ></div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">二级分类</label>
                    <div class="layui-input-block">
                        <div class="xmSelect"
                             data-name="category2"
                             data-sourceType="route"
                             data-source="/admin.sky.goods/filterGuide"
                             data-textField="name"
                             data-valueField="name"
                             data-paging="true"
                             data-radio="true"
                             data-layVerify="required"
                             data-direction="down"
                        ></div>
                    </div>
                </div>


                <div class="layui-form-item" style="width: 40%">
                    <label class="layui-form-label">标签</label>
                    <div class="layui-input-block">
                        <input type="text" name="tag" value="" lay-verify="required" autocomplete="off" placeholder="请输入标签" class="layui-input">
                    </div>
                </div>

            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">图片</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="img_url"
                         data-accept="image"
                         data-type="ali-oss"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">图鉴详情</label>
                <div class="layui-input-block">
                    <div class="laytpUpload"
                         data-name="relation_img"
                         data-accept="image"
                         data-type="ali-oss"
                         data-multi="true"
                         data-showChoiceBtn="false"
                    ></div>
                </div>
            </div>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="laytp-btn laytp-btn-primary laytp-btn-sm" lay-submit="" lay-filter="add">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="laytp-btn laytp-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script>
    if(localStorage.getItem("staticDomain")){
        document.write("<link rel='stylesheet' href='" + localStorage.getItem("staticDomain") + "/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='" + localStorage.getItem("staticDomain") + "/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }else{
        document.write("<link rel='stylesheet' href='/static/component/layui/css/layui.css?v=" + localStorage.getItem("version") + "'>");
        document.write("<script src='/static/component/layui/layui.js?v="+localStorage.getItem("version")+"'><\/script>");
        document.write("<script src='/static/component/laytp/layuiConfig.js?v="+localStorage.getItem("version")+"'><\/script>");
    }
</script>
<script>
    layui.use(['laytp'],function(){
        layui.form.on('submit(add)', function(data){
            var btnAnim = layui.button.load({elem:$(this)});
            facade.ajax({
                route:'/admin.sky.goods/add',
                data : data.field
            }).done(function(res){
                if(res.code === 0){
                    parent.layui.layer.close(parent.layui.layer.getFrameIndex(window.name));//关闭当前页
                    parent.layui.table.reload("laytp-table");
                }
                btnAnim.stop();
            }).fail(function(){
                btnAnim.stop();
            });
            return false;
        });
    })
</script>
</body>
</html>